using System;
using EPiServer.Common;
using EPiServer.Common.Visits;

namespace EPiAbstractions.Common.Visits
{
    public interface IVisitHandlerFacade
    {
        IVisit AddVisit(IVisit visit);

        IVisit GetVisit(Int32 id);

        void RemoveVisit(IVisit visit);

        VisitCollection GetVisits(IVisitableEntity visitableEntity, Boolean uniqueVisitors, Boolean includeUnknownVisitors, Int32 page,
                                  Int32 pageSize, TimeSpan explicitCacheExpiration, out Int32 totalItems, VisitSortOrder[] sortOrder);

        VisitCollection GetVisits(IVisitableEntity visitableEntity, Boolean uniqueVisitors, Boolean includeUnknownVisitors,
                                  DateTime startDate, DateTime endDate, Int32 page, Int32 pageSize, TimeSpan explicitCacheExpiration,
                                  out Int32 totalItems, VisitSortOrder[] sortOrder);

        VisitCollection GetVisits(IVisitableEntity visitableEntity, Boolean uniqueVisitors, Int32 page, Int32 pageSize,
                                  TimeSpan explicitCacheExpiration, out Int32 totalItems, VisitSortOrder[] sortOrder);

        VisitCollection GetVisits(IVisitableEntity visitableEntity, Boolean uniqueVisitors, DateTime startDate, DateTime endDate, Int32 page,
                                  Int32 pageSize, TimeSpan explicitCacheExpiration, out Int32 totalItems, VisitSortOrder[] sortOrder);

        VisitCollection GetVisits(IVisitableEntity visitableEntity, IAuthor visitor, DateTime startDate, DateTime endDate, Int32 page,
                                  Int32 pageSize, TimeSpan explicitCacheExpiration, out Int32 totalItems, VisitSortOrder[] sortOrder);

        Int32 GetNumVisits(IVisitableEntity visitableEntity);

        Int32 GetNumVisits(IVisitableEntity visitableEntity, DateTime startDate, DateTime endDate, TimeSpan explicitCacheExpiration);

        Int32 GetNumUniqueVisits(IVisitableEntity visitableEntity, DateTime startDate, DateTime endDate, TimeSpan explicitCacheExpiration);

        Int32 GetNumUniqueVisits(IVisitableEntity visitableEntity, TimeSpan explicitCacheExpiration);

        IVisit GetLastVisit(IVisitableEntity visitableEntity);

        VisitableEntityCollection GetVisitedItems(Int32 page, Int32 pageSize, TimeSpan explicitCacheExpiration, out Int32 totalItems,
                                                  VisitableEntitySortOrder[] sortOrder);

        VisitableEntityCollection GetVisitedItems(Type type, Int32 page, Int32 pageSize, TimeSpan explicitCacheExpiration,
                                                  out Int32 totalItems, VisitableEntitySortOrder[] sortOrder);

        VisitableEntityCollection GetVisitedItems(IAuthor visitor, Type type, Int32 page, Int32 pageSize, TimeSpan explicitCacheExpiration,
                                                  out Int32 totalItems, VisitableEntitySortOrder[] sortOrder);

        event EPiServerCommonEventHandler VisitAdded;

        event EPiServerCommonEventHandler VisitRemoved;
    }
}